-- prop
-- create by panyl
-- 道具：  致命伤害

return {
    apply = function(source, target, classId, value)
        local dbase = PropertyM.query(classId, "dbase") or {};
        local path = dbase["prop_path"];
        if not path then
            path = "mixed";
        end

        -- 如果需要覆盖掉旧属性
        if dbase["recover"] then
            PropM.deleteProp(target, path);
        end
        
        local round = CombatM.getRound();

        -- 普通属性
        if type(value[1]) == "table" then
            for _, prop in pairs(value) do
                if prop[4] ~= -1 then
                    prop[4] = prop[4] + round + 1;
                end

                PropM.record(target, prop, path);
            end
        else
            -- 单条属性
            if value[4] ~= -1 then
                value[4] = value[4] + round + 1;
            end

            PropM.record(target, value, path);
        end

        -- 抛事件
        EventMgr.fire(event.ADD_PROP, { ["effect_id"] = dbase.effect_id, });
    end,
};
